package com.yu.waterstation.app.moudles.timer;

import com.yu.waterstation.app.moudles.address.service.AddressServiceImpl;
import com.yu.waterstation.common.service.redis.RedisService;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@EnableScheduling
public class TimerTask {
    @Resource
    private RedisService redisService;
    @Resource
    private AddressServiceImpl addressService;

    // 定时刷新地址选择树
    @Scheduled(fixedDelay = 24 * 3600 * 1000)
    public void flushAddressTree(){
        addressService.getAddressTree();
    }

}
